package pl.omega.selenium;

import static org.junit.Assert.assertEquals;

import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import pl.omega.selenium.model.Film;

public class DeleteFilm extends pl.omega.selenium.pages.TestBase {

	@BeforeMethod
	public void mayBeLogout() {
		if (app.getUserHelper().isLoggedIn()) {
			return;
		}
		app.getUserHelper().loginAs(ADMIN);
	}

	@Test
	public void deleteFilm() {
		Film film = new Film();
		int countFilmBefore = app.getFilmHelper().getFilmCount();
		app.getFilmHelper().delete(film);
		int countFilmAfter = app.getFilmHelper().getFilmCount();
		assertEquals(countFilmBefore - 1, countFilmAfter);
	}
}
